import AddNodeCommand from '@/components/flow/cmd/AddNodeCommand.js';
import FlowModelInstance from '@/components/flow/typs/FlowModelInstance.js';

export default class NewBranchForGatewayCommand extends AddNodeCommand{
  ok(userTask) {
    userTask = userTask || this.userTask;
    let list = userTask.multiUserTask && userTask.multiUserTask.length && userTask.multiUserTask || [userTask];
    list = list.reverse();
    let flowModelInstance = new FlowModelInstance(this.supportInstance.getModel());
    list.forEach(t => flowModelInstance.addBranchForGateway(t, this.nodeId));
    this.supportInstance.setModel(flowModelInstance.getModelString());
  }
}